KnowledgeBases Class
The KnowledgeBases class manages the collection of knowledge bases, their creation, listing, and retrieval.Constructor
configuration
(Optional[Configuration]): SDK configuration. Uses environment variables if not provided.
Methods
acreate(name: str, description: Optional[str] = None)
Asynchronously create a new knowledge base.
name
(str): Name of the knowledge base.description
(Optional[str]): Optional description.
KnowledgeBase
object.
create(name: str, description: Optional[str] = None)
Synchronously create a new knowledge base.
acreate()
.
Returns: Created KnowledgeBase
object.
alist()
Asynchronously list all available knowledge bases.
KnowledgeBase
objects.
list()
Synchronously list all available knowledge bases.
KnowledgeBase
objects.
Related Types
KnowledgeBase
Represents a single knowledge base with document management and search capabilities.
Properties
id
(str): Unique identifier for the knowledge base.name
(str): Name of the knowledge base.type
(str): Type of the knowledge base.organization_id
(str): ID of the organization owning it.
Methods
Document Management
aadd_documents(document_urls: List[str], sync: Optional[bool] = False)
Asynchronously add new documents to the knowledge base.
document_urls
(List[str]): URLs of documents to add.sync
(Optional[bool]): Whether to sync the documents.
KnowledgeBaseDocumentItem
](/API reference/types#knowledgebasedocumentitem) objects.
add_documents(document_urls: List[str], sync: Optional[bool] = False)
Synchronously add new documents.
aadd_documents()
.
Returns: List of KnowledgeBaseDocumentItem
objects.
Search Operations
asearch(query: str)
Asynchronously perform search operations.
query
(str): Query string.
KnowledgeBaseSearchResult
](/API reference/types#knowledgebasesearchresult) objects.
search(query: str)
Synchronously perform search operations.
asearch()
.
Returns: List of KnowledgeBaseSearchResult
objects.
Knowledge Base Management
adelete()
Asynchronously delete the knowledge base.
delete()
Synchronously delete the knowledge base.
Related Types
See [SDK Types Reference](/API reference/types) for detailed information on:- [
KnowledgeBaseDocumentItem
](/API reference/types#knowledgebasedocumentitem): Document metadata - [
KnowledgeBaseSearchResult
](/API reference/types#knowledgebasesearchresult): Search result with content and relevance score
Error Handling
Methods may raiseModuleException
for SDK-related errors.
Continue to the [Knowledge Bases Module Reference](/API reference/knowledge) for full module documentation.